# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mutagen
pkgver=1.47.0
pkgrel=0
pkgdesc="Audio tagger implemented in Python"
url="https://github.com/quodlibet/mutagen"
arch="noarch"
license="GPL-2.0-or-later"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-xdist py3-flake8 py3-hypothesis"
subpackages="$pkgname-doc py3-$pkgname-pyc py3-$pkgname:py3"
source="mutagen-$pkgver.tar.gz::https://github.com/quodlibet/mutagen/archive/release-$pkgver.tar.gz"

builddir="$srcdir/$pkgname-release-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	pytest -n $JOBS
}

package() {
	depends="py3-mutagen=$pkgver-r$pkgrel"
	python3 -m installer -d "$pkgdir" \
		.dist/mutagen-*.whl
}

py3() {
	pkgdesc="Python3 library for $pkgname"
	replaces="py-mutagen" # for backwards compatibility
	provides="py-mutagen=$pkgver-r$pkgrel" # for backwards compatibility

	depends="python3"
	amove usr/lib/python*
}

sha512sums="
ee4bdf1aa468b6bcea8a98fdd6c2c579182fb3bf71e7adf8e6e3bd93333ab9ff049a0d7f35d4b01aed7c35f65baf44d2891f06a6e4cb11bbeebd30cc6fc96326  mutagen-1.47.0.tar.gz
"
